<?php
/**
 * This is the bootstrap file for application.
 *
 * @author     mole <mole1230@gmail.com>
 * @version    $Id: index.php 81 2011-01-05 03:56:31Z mole1230 $
 */

define('ROOT_PATH', __tidyPath(dirname(__FILE__)));
define('PROJECT', 'admin');
define('TIMESTAMP', $_SERVER['REQUEST_TIME']);
define('TIMEDATE', date('Y-m-d H:i:s', TIMESTAMP));

// set environment
//error_reporting(E_ALL | E_STRICT);
//defined('YII_DEBUG') or define('YII_DEBUG', true);
//defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);

// bootstrap
require_once ROOT_PATH . '/lib/yii/yii.php';
Yii::createWebApplication(ROOT_PATH . '/include/config/main.php')->run();

// tidy path
function __tidyPath($path)
{
    $path = realpath($path);
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('/\/{2,}/', '/', $path);
    $path = rtrim($path, '/');
    
    return $path;
}
